package com.lbn.jfqsc.app.message.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.lbn.baseframe.base.BaseRecyclerAdapter;
import com.lbn.baseframe.base.RecyclerViewHolder;
import com.lbn.baseframe.image.LoaderImage;
import com.lbn.baseframe.utils.DateUtils;
import com.lbn.jfqsc.R;
import com.lbn.jfqsc.business.bean.ActivityList;
import com.lbn.jfqsc.business.bean.CommentList;
import com.lbn.jfqsc.business.bean.SupportList;

import org.w3c.dom.Comment;

import java.util.List;

import butterknife.BindView;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * @author 李炳南
 * @date 2017/3/3
 */
public class DiscussAdapter extends BaseRecyclerAdapter<CommentList> {


    public DiscussAdapter(Context ctx, List<CommentList> list) {
        super(ctx, list);
    }

    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.layout_item_discuss;
    }

    @Override
    public void bindData(RecyclerViewHolder holder, int position, CommentList item) {
        CircleImageView userPhoto = holder.getView(R.id.user_photo);
        TextView userName = holder.getView(R.id.user_name);
        TextView content = holder.getView(R.id.content);
        TextView time = holder.getView(R.id.time);

        if (TextUtils.isEmpty(item.getUserHead())) {
            LoaderImage.displayImage("", userPhoto, R.mipmap.ic_launcher, 0);
        } else {
            LoaderImage.displayImage(item.getUserHead(), userPhoto);
        }
        userName.setText(item.getUserName());
        content.setText(item.getContent());
        time.setText(DateUtils.stampToDate(item.getDatetime()));
    }

}
